package io.renren.modules.lucky.dto.background;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

@Data
@ApiModel(value = "招财猫首页请求")
public class LuckyIndexReq implements Serializable {
    private static final long serialVersionUID = 2325932415330139949L;

    @ApiModelProperty(value = "开始时间 可不填,默认昨日往前七天")
    private String startTime;

    @ApiModelProperty(value = "结束时间 可不填,默认昨日往前七天")
    private String endTime;


    public LuckyIndexReq() {
        LocalDate yesterday = LocalDate.now().minusDays(1);
        LocalDate sevenDaysAgoFromYesterday = yesterday.minusDays(7);
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        this.startTime = yesterday.format(formatter);
        this.endTime = sevenDaysAgoFromYesterday.format(formatter);
    }
}
